home *** CD-ROM | disk | FTP | other *** search
- /* ----------------------------------------------------------------------- */
- /* J-Source Version 4.1 - COPYRIGHT 1992 Iverson Software Inc. */
- /* 33 Major Street, Toronto, Ontario, Canada, M5S 2K9, (416) 925 6096 */
- /* */
- /* J-Source is provided "as is" without warranty of any kind. */
- /* */
- /* J-Source Version 4.1 license agreement: You may use, copy, and */
- /* modify the source. You have a non-exclusive, royalty-free right */
- /* to redistribute source and executable files. */
- /* ----------------------------------------------------------------------- */
-
- /* */
- /* Global Definitions */
-
-
- #define SYS_AMIGA 1L
- #define SYS_ARCHIMEDES 2L
- #define SYS_ATARIST 4L
- #define SYS_ATT3B1 8L
- #define SYS_HPPA 16L
- #define SYS_IBMRS6000 32L
- #define SYS_MACINTOSH 64L
- #define SYS_MIPSR3000 128L
- #define SYS_NEXT 256L
- #define SYS_PCAT 512L
- #define SYS_PC386 1024L
- #define SYS_SGIIRIX 2048L
- #define SYS_SUN3 4096L
- #define SYS_SUN386I 8192L
- #define SYS_SUN4 16384L
- #define SYS_VAX 32768L
- #define SYS_386IX 65536L
-
- #define SYS SYS_AMIGA
- #define LINKJ 0
- #define WATERLOO 0
-
- #define SYS_ANSILIB (SYS_AMIGA + SYS_ARCHIMEDES + SYS_HPPA + \
- SYS_IBMRS6000 + SYS_MACINTOSH + SYS_PCAT + \
- SYS_PC386 + SYS_VMCMS)
- #define SYS_SESM (SYS_ARCHIMEDES + SYS_PCAT + SYS_MACINTOSH)
- #define SYS_UNIX (SYS_ATT3B1 + SYS_HPPA + SYS_IBMRS6000 + \
- SYS_MIPSR3000 + SYS_NEXT + SYS_SGIIRIX + \
- SYS_SUN3 + SYS_SUN386I + SYS_SUN4 + \
- SYS_VAX + SYS_386IX)
- #define SYS_LILENDIAN (SYS_ARCHIMEDES + SYS_ATT3B1 + SYS_PCAT + \
- SYS_PC386 + SYS_SUN386I + SYS_386IX)
-
-
- #if (SYS & SYS_ATARIST)
- #define __NO_INLINE__ 1
- #endif
-
- #if (SYS & SYS_UNIX)
- #include <memory.h>
- #include <sys/types.h>
- #endif
-
- #if (SYS & SYS_ANSILIB)
- #include <float.h>
- #include <limits.h>
- #include <stdlib.h>
- #endif
-
- #include <errno.h>
- #include <math.h>
- #include <signal.h>
- #include <stdio.h>
- #include <string.h>
- #include <time.h>
- #include "jc.h"
- #include "jt.h"
- #include "je.h"
-
-
- #if (SYS & SYS_LILENDIAN)
- #define XINF "\000\000\000\000\000\000\360\177"
- #define XNAN "\000\000\000\000\000\000\370\377"
- #endif
-
- #if (SYS & SYS_MACINTOSH)
- #define XINF "\177\377\000\000\000\000\000\000\000\000"
- #define XNAN "\377\377\100\000\000\000\000\000\000\000"
- #endif
-
- #ifndef XINF
- #define XINF "\177\360\000\000\000\000\000\000"
- #define XNAN "\377\370\000\000\000\000\000\000"
- #endif
-
-
- #ifndef PI
- #define PI 3.14159265358979323846
- #endif
- #ifndef LONG_MAX
- #define LONG_MAX 2147483647L
- #endif
- #ifndef LONG_MIN
- #define LONG_MIN (~2147483647L)
- #endif
- #ifndef OVERFLOW
- #define OVERFLOW 8.988465674311578e307
- #endif
- #ifndef UNDERFLOW
- #define UNDERFLOW 4.450147717014403e-308
- #endif
-
-
- #define NALP 256 /* size of alphabet */
- #define NINPUT 843 /* max # of chars in input line */
- #define NOBUF 100 /* length of obuf */
- #define NPP 20 /* max value for quad pp */
- #define NPROMPT 20 /* max length of immex prompt */
- #define NTSTACK 2000L /* size of stack for temps */
- #define RMAX 127 /* max rank */
- #define RMAXL 127L /* max rank, long */
-
-
- #define ABS(a) (0<=(a)?(a):-(a))
- #define DO(n,stm) {I i=0;I _n=(n); for(;i<_n;i++){stm}}
- #define EPILOG(z) R gc(z,_ttop)
- #define F1(f) A f( w)A w;
- #define F2(f) A f(a,w)A a,w;
- #define F1RANK(m,f,self) {RZ( w); if(m<AR(w)) \
- R rank1ex( w,(A)self,(I)m, f);}
- #define F2RANK(l,r,f,self) {RZ(a&&w); if(l<AR(a)||r<AR(w)) \
- R rank2ex(a,w,(A)self,(I)l,(I)r,f);}
- #define GA(v,t,n,r,s) RZ(v=ga((I)(t),(I)(n),(I)(r),(I*)(s)))
- #define IC(w) (AR(w) ? *AS(w) : 1L)
- #define JSPR(fmt,x) {sprintf(obuf,fmt,x); jouts(obuf);}
- #define MAX(a,b) ((a)>(b)?(a):(b))
- #define MIN(a,b) ((a)<(b)?(a):(b))
- #define PROLOG I _ttop=tbase+ttop
- #define R return
- #define RE(exp) {if((exp),jerr)R 0;}
- #define RZ(exp) {if(!(exp))R 0;}
- #define SGN(a) ((0<(a))-(0>(a)))
-
-
- #ifndef CLOCKS_PER_SEC
- #if (SYS & SYS_UNIX)
- #define CLOCKS_PER_SEC 1000000
- #endif
- #ifdef CLK_TCK
- #define CLOCKS_PER_SEC CLK_TCK
- #endif
- #endif
-
- #if (WATERLOO)
- #define CLOCK (m_cpu())
- #else
- #if (SYS & SYS_AMIGA)
- #define CLOCK (time(0))
- #else
- #define CLOCK ((D)clock()/CLOCKS_PER_SEC)
- #endif
- #endif
-
- #if (SYS & SYS_AMIGA)
- #ifndef size_t
- #define size_t unsigned /* why why why?? */
- #endif
- #endif
-
- #define ASSERT(b,e) {if(!(b)){jsignal(e); R 0;}}
-
- #define EVBREAK 1
- #define EVDEFN 2
- #define EVDOMAIN 3
- #define EVILNAME 4
- #define EVILNUM 5
- #define EVINDEX 6
- #define EVFACE 7
- #define EVLENGTH 8
- #define EVLIMIT 9
- #define EVNONCE 10
- #define EVNOTASGN 11
- #define EVOPENQ 12
- #define EVRANK 13
- #define EVSPELL 14
- #define EVSYNTAX 15
- #define EVSYSTEM 16
- #define EVVALUE 17
- #define EVWSFULL 18
-
- #define NEVM 18 /* number of event codes */
-
-